<html>
  <head>
    <meta charset="utf-8">
    <title>test array unique</title>
  </head>
  <body>

   <button id="btn" >查询</button>
             
  </body>
  <script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>

  <script>
Array.prototype.unique3 = function(){
 var res = [];
 var json = {};
 for(var i = 0; i < this.length; i++){
  if(!json[this[i]]){
   res.push(this[i]);
   json[this[i]] = 1;
   console.log(json);
  }
 }
 return res;
}
var arr = [112,112,34,'你好',112,112,34,'你好','str','str1'];
alert(arr.unique3());
  </script>
</html>
